﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using MVCWorkflow.Models;

namespace MVCWorkflow.Workflows
{
public sealed class Retained : NativeActivity
{
    public InArgument<int> ArticleID { get; set; }

    protected override void Execute(NativeActivityContext context)
    {
        DataContext db = new DataContext();

        int articleID = context.GetValue<int>(ArticleID);

        Article article = db.Articles.Single(e => e.ArticleID == articleID);
        article.State = "Retained";

        db.SaveChanges();
    }
}
}
